import {reqGoodsListInfo} from '@/api'
const state = {
    goodsListInfo:{}
};
const mutations = {
    REQ_GOODSLISTINFO(state,goodsListInfo){
        state.goodsListInfo = goodsListInfo
    }
};
const actions = {
    async getGoodsListInfo({commit},searchParams){
        const result = await reqGoodsListInfo(searchParams);
        if(result.code === 200){
            commit('REQ_GOODSLISTINFO',result.data)
        }
    }
};
// getters的作用是简化数据操作
const getters = {
    attrsList(state){
        return state.goodsListInfo.attrsList || [];
    },
    goodsList(state){
        return state.goodsListInfo.goodsList || [];
    },
    trademarkList(state){
        return state.goodsListInfo.trademarkList || [];
    }
};

export default {
    state,
    actions,
    mutations,
    getters
}